var Htype = {
		"1" : "蓝居友家",
		"2" : "蓝居整租",
		"3" : "业主直租"
};
var typeArr =["户型","朝向","房子标签"];

var Zezu=({
	initList:function(){
		var search = $("#search").val();
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : path + "/house/queryHouseList.do",
			data : {
				"offset": offset,
				"limit": limit,
				"orderBy":orderBy,
				"type":type,
				"grade":grade,
				"flagArr": JSON.stringify(flagArr),
				"search":search
			},
			success : function(data) {
				var html ="";
				if(data.rows.length>0){
					$(data.rows).each(function(i,n){
						html+="<li id='"+n.houseId+"'>"+
					"<img class='tuijian_house_content_img' src='"+path+"/images/houseLogo/"+n.imgUrl+"'>"+
					"<div class='house_title'>"+Htype[n.type]+"·"+(n.houseName.length>25?(n.houseName.substring(0,25)+"..."):n.houseName)+"</div>"+
					"<div class='house_title house_price'><span class='house_size'>"+n.houseSize+"平方</span><span class='house_type' style='margin-left: 25px;'>"+(n.layout==undefined?"暂无房型":n.layout)+"</span><span class='price' style='    float: right;    margin-right: 25px;'>"+n.price+"元/月</span></div>"+
					"<div class='house_title house_address'><span class='jiaotong'><img src='"+path+"/images/postion.png' class='position'>距离"+n.location+n.distance+"米</span> </div></li>";
					
					})
					$(".house_ul").append(html);
				}else{
					mui.toast("加载完毕");
					offset = offset-limit;
					if($(".house_ul").children().length==0){
						$(".house_ul").html("<li>抱歉！暂无数据</li>");
					}
				}
				$("#loadmore").hide();
        		$(".page__desc").show();
			}
		});
	},
	//筛选加载数据
	queryAllFlag :function () {
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : path + "/house/queryAllFlag",
			success : function(data) {
				if(data.rows.length>0){
					var layoutHtml ="";
					var towardHtml ="";
					var flagHtml ="";
					$(data.rows).each(function(i,n){
						if(n.type==1){
							layoutHtml+="<li id='"+n.flagName+"'><a>"+n.flagName+"</a></li>";
						}
						if(n.type==2){
							towardHtml+="<li id='"+n.flagName+"'><a>"+n.flagName+"</a></li>";
						}
						if(n.type==3){
							flagHtml+="<li id='"+n.flagName+"'><a>"+n.flagName+"</a></li>";
						}
					})
					
					$("#layout").html(layoutHtml);
					$("#towards").html(towardHtml);
					$("#houseFlag").html(flagHtml);
				}
			}
		});
	}
})